/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-03-19
 * Time: 9:08
 */
class Student {
    private String name;
    private int age;
    public static String classRoom = "208";

//    static {
//        classRoom = "201";
//        System.out.println("静态代码块");
//    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("调用两个方法");
    }

//    {
//        System.out.println("构造快");
//    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
    public void print() {
        System.out.println("name:"+this.name+" age:"+this.age);
    }

//    public String toString() {
//        return "name:"+this.name+" age:"+this.age;
//    }

    //重写
    @Override//注释+解释
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
public class Test {
    public static void main(String[] args) {
        //System.out.println(Student.classRoom);
        Student student1 = new Student("lisi",19);
        student1.print();
        System.out.println(student1);
        //Student student2 = new Student("WANGWU",15);
    }
//    static int a= 10;
//    public static void main(String[] args) {
//        System.out.println(a);
//    }


}
